home *** CD-ROM | disk | FTP | other *** search
/ Web Designer 98 (Professional) / WebDesigner 1.0.iso / cgi2 / countdown_tar.z / countdown_tar / countdown / README < prev   
Encoding:
Text File  |  1996-07-13  |  11.0 KB  |  204 lines

  1. ##############################################################################
  2. # Countdown                     Version 1.21                                 #
  3. # Copyright 1996 Matt Wright    mattw@worldwidemart.com                      #
  4. # Created 9/1/95                Last Modified 10/8/95                        #
  5. # Scripts Archive at:           http://www.worldwidemart.com/scripts/        #
  6. ##############################################################################
  7. # If you run into any problems while trying to configure this scripts, help  #
  8. # is available.  The steps you should take to get the fastest results, are:  #
  9. #       1) Read this file thoroughly                         #
  10. #       2) Consult the Matt's Script Archive Frequently Asked Questions:     #
  11. #               http://www.worldwidemart.com/scripts/faq/             #
  12. #       3) If you are still having difficulty installing this script, send   #
  13. #          e-mail to: scripts-help@tahoenet.com                     #
  14. #          Include any error messages you are receiving and as much detail   #
  15. #          as you can so we can spot your problem.  Also include the variable#
  16. #          configuration block that is located at the top of the script.     #
  17. #                                         #
  18. # Hopefully we will be able to help you solve your problems.  Thank you.     #
  19. ##############################################################################
  20. # COPYRIGHT NOTICE                                                           #
  21. # Copyright 1996 Matthew M. Wright  All Rights Reserved.                     #
  22. #                                                                            #
  23. # Countdown may be used and modified free of charge by anyone so long as     #
  24. # this copyright notice and the comments above remain intact.  By using this #
  25. # code you agree to indemnify Matthew M. Wright from any liability that      #  
  26. # might arise from it's use.                                                 #  
  27. #                                                                            #
  28. # Selling the code for this program without prior written consent is         #
  29. # expressly forbidden.  In other words, please ask first before you try and  #
  30. # make money off of my program.                                              #
  31. #                                                                            #
  32. # Obtain permission before redistributing this software over the Internet or #
  33. # in any other medium.    In all cases copyright and header must remain intact.#
  34. ##############################################################################
  35.  
  36. The Countdown script is a somewhat simple script, which takes the time you give 
  37. it and tells you the number of years, months, days, hours, minutes, seconds 
  38. until that event will occur.  More details on how to use this script are below.
  39.  
  40. WHAT THIS SCRIPT CONTAINS:
  41.         This script comes with 3 different files:
  42.                 1) countdown.pl - The Perl script which does the calculation 
  43.                                   of the time until an event will occur.
  44.                 2) README - The file that does all the explaining.
  45.                 3) countdown.html - An example of ways to incorporate 
  46.                    countdown.pl and use it properly.
  47.  
  48.  
  49. You will have to do some minimal configuration of the countdown.pl file:
  50.  
  51. COUNTDOWN.PL -
  52.         The countdown.pl file is the main file in this package.  This file 
  53. needs to be placed in the server's cgi-bin or have its name changed to 
  54. countdown.cgi.  Keep in mind the latter option only works should your server 
  55. be set up to treat all .cgi files in a script manner.  If you are not sure 
  56. about this, consult your system administrator.  Inside the countdown.pl file 
  57. you can do one of two things:
  58.  
  59.         1) If you plan to just call the same date every time from this 
  60.            script, change the @from_date variable to the date you want it 
  61.            to countdown to.  This can include all the way up to seconds.  The
  62.            format for this should look like:
  63.  
  64.               @from_date = (yyyy,mm,dd,hh,mm,ss);
  65.  
  66.                 Where:
  67.                         yyyy - The Year in Four Digits.
  68.                         mm   - The first mm is the month number from 1-12.
  69.                         dd   - The Day of the month.  Values range from 1-31.
  70.                         hh   - The hour of the day.  Values range from 0-23.
  71.                         mm   - The second mm is the minute of the hour from 
  72.                                0-59.
  73.                         ss   - The ss stands for seconds and the value can 
  74.                                range from 0-59.
  75.  
  76.         2) If you plan to call different dates via a html page, you don't have 
  77.            to worry about setting any variables inside the script.
  78.  
  79. At any rate you will probably want to edit the subroutines &html_header and 
  80. &html_trailer, to customize it for your wants/needs.
  81.  
  82. ------------------------------------------------------------------------------
  83.  
  84. HOW DO I IMPLEMENT THIS?!
  85.  
  86. 1) If you have defined the @from_date in the countdown.pl file and you wish to 
  87.    only call the same value each time, you can simply do the following:
  88.  
  89.    <a href="http://your.server/cgi-bin/countdown.pl">Countdown to ...</a>
  90.  
  91.    When the user clicks on this they will be taken to a cgi generated page that
  92.    tells them the countdown status.
  93.  
  94. 2) Should you want to use this counter for various countdown you can also call 
  95.    a specific date directly from the link, in the same fashion as you would 
  96.    have defined @from_date. (See Above for info on how to define @from_date.)
  97.    Let's say I want to countdown to my birthday in 1996.  My birthday is 
  98.    April 15: 4/15, so I would do something like:
  99.  
  100.     <a href="http://my.server/cgi-bin/countdown.pl?1996,4,15,0,0,0">Countdown 
  101.     to my birthday!</a>
  102.  
  103. 3)  Allow users to countdown to their own dates!  If you want to do this you 
  104.     would use the following syntax:
  105.  
  106.     <FORM METHOD=GET ACTION="http://your.server/cgi-bin/countdown.pl">
  107.     <INPUT TYPE=TEXT NAME=""><P>
  108.     <INPUT TYPE=SUBMIT>
  109.     </FORM>
  110.  
  111.     Then when the user types in his/her query the program will generate an 
  112.     automatic response.  Make sure to let your users and yourself know that 
  113.     the format for the query must match the exact same definition as @from_date. 
  114.     (See Above for info on how to define @form_date.)
  115. -------------------------------------------------------------------------------
  116.  
  117. ADVANCED FEATURES OF COUNTDOWN!
  118.  
  119. In Some situations it may be impractical to count out to seconds.  Or maybe if 
  120. you are counting down to something closer than year, you will want to leave 
  121. out the year portion of the countdown since it is only going to be 0 all the 
  122. tie anyways.  Or maybe the same goes for month, day, etc...  Countdown has a 
  123. built in feature to allow you to do this.  Instead of defining all categories 
  124. in @from_date you can do the following:
  125.  
  126. 1) Say I want to leave out the year in the countdown to my birthday (From the 
  127.    example above.) I could also do this:
  128.  
  129.     <a href="http://my.server/cgi-bin/countdown.pl?XX,4,15,0,0,0">Countdown
  130.     to my birthday!</a>
  131.  
  132.    When the user gets the returned html document, the # of years will not be 
  133.    shown.  You can put an 'XX' in any of the fields (year, month, day, hour, 
  134.    minute, second) and it will disregard that amount of time.
  135.  
  136. 2) You can also define the same way inside of the countdown.pl.  If you are 
  137.    using a standard countdown, meaning that you see no need for  multiple 
  138.    countdowns, you can set your @from_date in your Perl script to reflect this 
  139.    (This concept is also mentioned above).  You can substitute in 'XX' for any 
  140.    amount of time you don't want. (Be it year, month, day, hour, minute, or
  141.    second)
  142.  
  143. -------------------------------------------------------------------------------
  144.  
  145. OTHER USEFUL THINGS COUNTDOWN DOES BEHIND THE SCENES:
  146.  
  147. 1) Will not return a negative value.  Often times you would see a negative 
  148.    number of hours.  Instead, when countdown comes across a negative value, it 
  149.    simply adds the correct number (12 for months, appropriate number for days, 
  150.    24 for hours, 60 for minutes and seconds).  It then subtracts one from the
  151.    next highest category so that your time comes out perfect, and all in 
  152.    positive time.  Years will appear in negative time, since if you are that 
  153.    far behind, you're messed up!  :)
  154.  
  155. 2) Calculates number of days in each month,and recognizes leap years to!
  156.  
  157. 3) Notices the difference between 1 hour and 2 hours.  So that you get proper 
  158.    English instead of 1 hours. Works the same for other units.
  159.  
  160. ------------------------------------------------------------------------------
  161.  
  162. HISTORY:
  163. Version 1.0             9/1  - Script Created.
  164. Version 1.1             9/3  - Improved the script based on suggestions by 
  165.                                Scott Lipcon:
  166.                                - Added an extra 0 to the seconds and minutes 
  167.                                  if the times were less than ten, so the 
  168.                                  clock came out looking like 5:00:00 instead
  169.                                  of 5:0:0
  170.                                - Changed the '.' in the time to a ':' between 
  171.                                  seconds and minutes so that clock looks 
  172.                                  like: '5:00:00' instead of '5:00.00'
  173.                                - Corrected the leap year system, so that it 
  174.                                  will get leap years correct.
  175.                                - Commented the file better.
  176.                              - Edited the README file slightly.
  177. Version 1.2             9/8  - Several bugs fixed based on the obersvations by 
  178.                                Elton Taupin.
  179.                                - Bug fixed that caused current date to be 
  180.                                  screwed up when the time was < 10 minutes.  
  181.                                  The problem had something to do with a 
  182.                                  misplaced colon.
  183.                                - Fixed a bug in the countdown portion of the 
  184.                                  script, which caused an extra date to be 
  185.                                  displayed on the countdown on certain 
  186.                                  instances.  It was a case of subtracting 
  187.                                  from $month, instead of $real_month.
  188. Version 1.21                   - Slight bug with 1 too many months fixed.
  189. -----------------------------------------------------------------------------
  190.  
  191. This script is provided to be useful and comes with no warranty, express or 
  192. implied.  I cannot guarantee the safety of it, yet I see no urgent problems.  
  193. I only did my best.
  194.  
  195. If you end up using this script, I would like to know where it is 
  196. implemented.  If you let me know I can add you to my list of other sites using 
  197. this script, or if you wish not to be added, I will keep your site private.  I 
  198. just want to know.  You can register this script at:
  199.         http://worldwidemart.com/scripts/implement.html
  200.  
  201. This script is provided for free, so I hope you enjoy it!
  202. ______________________________________________________________________________
  203. Matt Wright - mattw@worldwidemart.com - http://www.worldwidemart.com/scripts/
  204.